package com.weayer.controller;

import com.weayer.dto.ResponseResult;
import com.weayer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @description:  Api服务 - 乘客 - 用户controller
 * @author: Weayer
 **/
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/users")
    public ResponseResult getUser(HttpServletRequest request){
        // http请求中获取 refreshToken
        String refreshToken = request.getHeader("Authorization");
        return userService.getUserByAccessToken(refreshToken);
    }
}
